package atom.core0.app.thread.pool;
/**
 * Title: 多个线程池的管理
 * Description:
 * Copyright: Copyright (c) 2010
 * @author hike_man@126.com
 * @version 1.0
 */
import java.util.HashMap;

public class MutiThreadPoolManager
{
    private static MutiThreadPoolManager instance = new MutiThreadPoolManager();
    private static HashMap threadPoolMap = new HashMap();
    public static MutiThreadPoolManager getInstance() 
    {
        return instance;
    }
    public void setThreadPoolSize(String sChannelNo,int iMaxPoolSize)
    {
    	MutiThreadPool threadPool;
    	threadPool = (MutiThreadPool)threadPoolMap.get(sChannelNo);
    	if (threadPool==null)
    	{
    		threadPool = new MutiThreadPool(iMaxPoolSize,sChannelNo);
    		threadPoolMap.put(sChannelNo, threadPool);
    	}
    	else
    		threadPool.setMaximumPoolSize(iMaxPoolSize);
    }
    synchronized public MutiThreadPool getMutiThreadPool(String sChannelNo)
    {
    	MutiThreadPool threadPool;
    	threadPool = (MutiThreadPool)threadPoolMap.get(sChannelNo);
    	return threadPool;
    }
}
//使用方法
//一次设置
//MutiThreadPoolManager.getInstance().setThreadPoolSize("ch1_0",10);
//多次使用
//MutiThreadPoolManager.getInstance().getMutiThreadPool("ch1_0").execute(XXX);
//
//渠道线程池命名规则
//批量交易的ch1_0 批量查询的ch1_1

